package com.sportwise.dao.impl;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.sportwise.dao.AccountDao;
import com.sportwise.domain.User;

@Repository
public class AccountDaoImpl extends AbstractDaoImpl implements AccountDao {

	private static final String SQL_INSERT = String.format("INSERT INTO account(display_name, email) VALUES (?,?)");

	public AccountDaoImpl() {

	}

	@Override
	@Transactional(readOnly=false)
	public int insert(User user) {
		return this.getJdbcTemplate().update(SQL_INSERT, new Object[] { user.getDisplayName(), user.getEmail() });
	}
}
